import * as echarts from 'echarts'

export const Option1 = () => {
  const option = {
    tooltip: {
        trigger: 'axis',

        show: true,
        backgroundColor: '#02090d',
        borderColor: 'rgba(26, 128, 254, 0.4)', // 边框颜色
        axisPointer: {
            type: 'shadow',
            label: {
                backgroundColor: 'rgba(17, 27, 54, 1)'
            }
        },
        y: 'center',
        textStyle: {
            color: '#879DB3',
            fontSize: 17,
          }
    },
    grid: {
      top: '36px',
      left: '0px',
      bottom: '0px',
      right: '28px',
      containLabel: true,
    },
    xAxis: [
        {
            type: 'category',
            axisTick: {
                //坐标轴刻度相关设置。
                show: false
            },
            axisLine: {
                lineStyle: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(169, 203, 223, 1)'
                    }
                }
            },
            splitArea: {
                // show: true,
                color: '#f00',
                lineStyle: {
                    color: '#f00'
                }
            },
            axisLabel: {
                // interval: 0,
                // rotate: 40,
                textStyle: {
                    show: true,
                    color: '#A9CBDF',
                    fontSize: 17,
                  }
            },
            splitLine: {
                show: false
            },
            boundaryGap: true,
            data: ['2019', '2020', '2021', '2022', '2023']
        }
    ],
    yAxis: [
        {
            type: 'value',
            min: 0,
            max: 140,
            splitNumber: 5,
            axisLine: {
                show: false,
                lineStyle: {
                    color: '#8c9493'
                }
            },
            position: 'left',
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'solid',
                    color: '#879DB3',
                    opacity: 0.2
                }
            },
            axisLabel: {
                textStyle: {
                    fontWeight: 600,
                    color: '#879DB3',
                    fontSize: 17,
                  }
            }
        }
    ],
    series: [
        {
            name: '教师总数量',
            type: 'line',
            smooth: true, //是否平滑曲线显示
            // 			symbol:'circle',  // 默认是空心圆（中间是白色的），改成实心圆
            symbolSize: 0,

            lineStyle: {
                normal: {
                    color: '#3deaff' // 线条颜色
                }
            },
            areaStyle: {
                //区域填充样式
                normal: {
                    //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                    color: new echarts.graphic.LinearGradient(
                        0,
                        0,
                        0,
                        1,
                        [
                            { offset: 0, color: 'rgba(61,234,255, 0.9)' },
                            { offset: 0.7, color: 'rgba(13,46,98, 0.5)' }
                        ],
                        false
                    ),

                    shadowColor: 'rgba(53,142,215, 0.9)', //阴影颜色
                    shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
                }
            },
            data: [90, 105, 84, 125, 110]
        }
    ]
}

return option
}
export const Option2 = () => {
  function getOptions() {
    let f =
      ''
    let d =
      ''
    let a = [
        {
          other: '0.1634',
          sort: 1645454.7071,
          value: '1645454.7071',
          key: '幼儿园',
        },
        {
          other: '0.1292',
          sort: 1301048.301,
          value: '1301048.3010',
          key: '义务教育',
        },
        {
          other: '0.1178',
          sort: 1186222.7467,
          value: '1186222.7467',
          key: '高中',
        },
        {
          other: '0.1102',
          sort: 1109709.0521,
          value: '1109709.0521',
          key: '高等教育',
        },
        {
          other: '0.1102',
          sort: 1109698.4473,
          value: '1109698.4473',
          key: '专门学校',
        },
        {
          other: '0.0912',
          sort: 918409.5712,
          value: '918409.5712',
          key: '特殊教育',
        },
      ],
      e: {
        series: any
        xAxis: any
        color: any
        color2: any
        backgroundColor?: string
        animation?: boolean
        yAxis?: {
          type: string
          axisLabel: { show: boolean }
          position: string
          splitNumber: number
          splitLine: {
            show: boolean
            lineStyle: { type: string; color: string }
          }
        }
        grid?: {
          show: boolean
          top: string
          bottom: string
          left: string
          right: string
        }
      }
    let u = new echarts.graphic.LinearGradient(
        0,
        1,
        0,
        0,
        [
          {
            offset: 0,
            color: 'rgba(63, 190, 255, 1)',
          },
          {
            offset: 1,
            color: 'rgba(26, 128, 254, 0.5)',
          },
        ],
        !1
      ),
      y = new echarts.graphic.LinearGradient(
        0,
        1,
        0,
        0,
        [
          {
            offset: 0,
            color: 'rgba(255, 244, 92, 1)',
          },
          {
            offset: 1,
            color: 'rgba(255, 182, 26, 0.5)',
          },
        ],
        !1
      )
    let c: any = [],
      h: string[] = []
    a.forEach((item) => {
      const { key } = item
      if (key === '义务教育') {
        c.push(y)
        h.push('#FFD700')
      } else {
        c.push(u)
        h.push('rgba(63, 190, 255, 1)')
      }
    })

    e = {
      color: c,
      color2: h,
      animation: !0,
      xAxis: {
        type: 'category',
        data: [],
        axisTick: {
          show: !1,
        },
        axisLine: {
          show: !1,
        },
        axisLabel: {
          margin: 6,
          textStyle: {
            color: 'rgba(169, 203, 223, 1)',
            fontSize: 17,
          },
        },
      },
      yAxis: {
        type: 'value',
        axisLabel: {
          show: !1,
        },

        position: 'right',
        splitNumber: 3,
        splitLine: {
          show: false,
          lineStyle: {
            type: 'solid',
            color: '#879DB3',
          },
        },
      },
      grid: {
        show: !1,
        top: '20px',
        left: '0%',
        bottom: '14%',
        right: '0%',
      },
      series: [
        {
          name: '标签',
          type: 'pictorialBar',
          animation: !0,
          symbol: 'rect',
          symbolSize: ['30%', '100%'],
          data: [],
          z: 2,
          symbolOffset: ['0', -30],
        },
        {
          name: 'b',
          stack: 'amount',
          tooltip: {
            show: !1,
          },
          type: 'pictorialBar',
          symbol: 'diamond',
          symbolSize: [30, 30],
          symbolOffset: ['0', -44],
          symbolPosition: 'end',
          data: [],
          z: 3,
        },
        {
          name: 'c',
          stack: 'amount',
          tooltip: {
            show: !1,
          },
          type: 'pictorialBar',
          symbol: 'diamond',
          symbolSize: [30, 30],
          symbolOffset: ['0', -14],
          symbolPosition: 'start',
          data: [],
          z: 3,
        },
        {
          name: 'd',
          tooltip: {
            show: !1,
          },
          type: 'pictorialBar',
          symbol: 'rect',
          symbolSize: [30, '100%'],
          data: [],
          z: 0,
          symbolOffset: ['0', -30],
        },
        {
          name: 'd2',
          tooltip: {
            show: !1,
          },
          type: 'pictorialBar',
          symbol: 'image://' + d,
          symbolSize: [2, '100%'],
          data: [],
          z: 10,
          symbolOffset: ['0', -20],
        },
        {
          name: 'e',
          stack: 'amount',
          tooltip: {
            show: !1,
          },
          type: 'pictorialBar',
          symbol: 'diamond',
          symbolSize: [30, 30],
          symbolOffset: ['0', -42.8],
          symbolPosition: 'end',
          data: [],
          z: 0,
          label: {
            show: !0,
            position: 'top',
            padding: [0, 0, -4, 0],
            formatter: function (i: { dataIndex: any; name: string }) {
              let n = i.dataIndex,
                l = a[n].value,
                p = a[n].other
              return (
                (l =
                  Number(l) > 9999 ? (Number(l) / 1e4).toFixed(1) + '万' : l),
                i.name == '义务教育'
                  ? '{a|' +
                    l +
                    `}
{c|` +
                    p +
                    '}'
                  : '{b|' +
                    l +
                    `}
{c|` +
                    p +
                    '}'
              )
            },
            rich: {
              a: {
                color: 'rgba(255, 244, 92, 1)',
                fontSize: 20,
                fontWeight: 'bold',
                align: 'center',
              },
              b: {
                color: 'rgba(63, 190, 255, 1)',
                fontSize: 20,
                fontWeight: 'bold',
                align: 'center',
              },
              c: {
                color: 'rgba(63, 190, 255, 1)',
                fontSize: 14,
                align: 'center',
                borderWitdh: 10,
                borderColor: 'red',
                verticalAlign: 'top',
              },
            },
            fontSize: 20,
            fontWeight: 'bold',
          },
        },
      ],
    }
    e.series[0].name = '数量'
    a.forEach((item, t) => {
      e.xAxis.data.push(item.key)
      e.series[0].data.push({
        value: Number(a[t].value),
        itemStyle: {
          color: e.color[t % e.color.length],
        },
        animation: !1,
      })
      e.series[1].data.push({
        value: Number(a[t].value) + 4.5,
        itemStyle: {
          color: e.color[t % e.color.length],
        },
        animation: !1,
      })
      e.series[2].data.push({
        value: 4.5,
        itemStyle: {
          color: e.color2[t % e.color2.length],
        },
        animation: !1,
      })
      e.series[3].data.push({
        value: Number(a[0].value) * 1.3,
        itemStyle: {
          color: e.color2[t % e.color.length],
          opacity: 0.3,
        },
        emphasis: {
          itemStyle: {
            color: e.color2[t % e.color.length],
          },
        },
        animation: !1,
      })
      e.series[4].data.push({
        value: Number(a[0].value) * 1.3 + 4.5,
        itemStyle: {
          color: e.color2[t % e.color.length],
          opacity: 0.4,
        },
        emphasis: {
          itemStyle: {
            color: e.color2[t % e.color.length],
          },
        },
        animation: !1,
      })
      e.series[5].data.push({
        value: Number(a[0].value) * 1.3 + 4.5,
        itemStyle: {
          color: e.color2[t % e.color.length],
          opacity: 0.7,
        },
        emphasis: {
          itemStyle: {
            color: e.color2[t % e.color.length],
          },
        },
        animation: !1,
      })
    })

    return e
  }
  const option = getOptions()

  return option
}
export const Option3 = () => {
  const option = {
    tooltip: {
        trigger: 'axis',

        show: true,
        backgroundColor: '#02090d',
        borderColor: 'rgba(26, 128, 254, 0.4)', // 边框颜色
        axisPointer: {
            type: 'shadow',
            label: {
                backgroundColor: 'rgba(17, 27, 54, 1)'
            }
        },
        y: 'center',
        textStyle: {
            color: '#879DB3',
            fontSize: 17,
          }
    },
    grid: {
      top: '36px',
      left: '0px',
      bottom: '0px',
      right: '28px',
      containLabel: true,
    },
    xAxis: [
        {
            type: 'category',
            axisTick: {
                //坐标轴刻度相关设置。
                show: false
            },
            axisLine: {
                lineStyle: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(169, 203, 223, 1)'
                    }
                }
            },
            splitArea: {
                // show: true,
                color: '#f00',
                lineStyle: {
                    color: '#f00'
                }
            },
            axisLabel: {
                // interval: 0,
                // rotate: 40,
                textStyle: {
                    show: true,
                    color: '#A9CBDF',
                    fontSize: 17,
                  }
            },
            splitLine: {
                show: false
            },
            boundaryGap: true,
            data: ['2019', '2020', '2021', '2022', '2023']
        }
    ],
    yAxis: [
        {
            type: 'value',
            min: 0,
            max: 140,
            splitNumber: 5,
            axisLine: {
                show: false,
                lineStyle: {
                    color: '#8c9493'
                }
            },
            position: 'left',
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'solid',
                    color: '#879DB3',
                    opacity: 0.2
                }
            },
            axisLabel: {
                textStyle: {
                    fontWeight: 600,
                    color: '#879DB3',
                    fontSize: 17,
                  }
            }
        }
    ],
    series: [
        {
            name: '教师总数量',
            type: 'line',
            smooth: true, //是否平滑曲线显示
            // 			symbol:'circle',  // 默认是空心圆（中间是白色的），改成实心圆
            symbolSize: 0,

            lineStyle: {
                normal: {
                    color: '#3deaff' // 线条颜色
                }
            },
            areaStyle: {
                //区域填充样式
                normal: {
                    //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                    color: new echarts.graphic.LinearGradient(
                        0,
                        0,
                        0,
                        1,
                        [
                            { offset: 0, color: 'rgba(77, 250, 255, .8)' },
                            { offset: 0.7, color: 'rgba(77, 250, 255, .2)' }
                        ],
                        false
                    ),

                    shadowColor: 'rgba(77, 250, 255, .9)', //阴影颜色
                    shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
                }
            },
            data: [90, 105, 84, 125, 110]
        }
    ]
}

return option
}